package com.kaibes.module.permission.db.service;

import java.util.List;

import org.springframework.stereotype.Service;

import com.kaibes.module.permission.db.entity.Power;
import com.kaibes.orm.curd.QueryBuilder;
import com.kaibes.web.api.ResponseServiceImpl;

@Service
public class PowerService extends ResponseServiceImpl<Power> {

    public List<Power> listByRoleId(Integer roleId) {
        return list(QueryBuilder.newBuilder().eq("role_id", roleId).build());
    }
    
    public long countByRoleIdAndName(Integer roleId, String name) {
        return count(QueryBuilder.newBuilder().eq("role_id", roleId).eq("name", name).build());
    }

}
